package com.horizon.cloud.standard.config;

import com.horizon.cloud.distribute.zookeeper.CuratorZKClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

@Configuration
@ConditionalOnProperty(prefix = "zookeeper", name="address",matchIfMissing = false)
public class CustomedZookeeperAutoConfiguration {

    @Value("${zookeeper.address}")
    private String zkAddress;

    /**
     * 用bean的方式获取单例
     */
    @Bean(name="zKClient")
    public CuratorZKClient zKClient() {
        return new CuratorZKClient(zkAddress);
    }

    /**
     * zk限流器的bean
     */

}
